const path = require('path')
const resolve = (dir) => path.join(__dirname, dir) // 路径

module.exports = {
    // lintOnSave: false, //关闭eslint检查
    publicPath: process.env.BASE_URL,
    productionSourceMap: false,
    configureWebpack: {
        module: {
            rules: [
                {
                    test: /\.mjs$/,
                    include: /node_modules/,
                    type: "javascript/auto"
                }
            ]
        }
    },
    chainWebpack: (config) => {
        config.module.rule('svg').exclude.add(resolve('src/assets/icons')).end()
        config.module
            .rule('icons')
            .test(/\.svg$/)
            .include.add(resolve('src/assets/icons'))
            .end()
            .use('svg-sprite-loader')
            .loader('svg-sprite-loader')
            .options({
                symbolId: 'icon-[name]'
            })
    },
    css: {
        loaderOptions: {
            less: {
                javascriptEnabled: true,
            },
        },
    }
}
